package com.micro.ai.template.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import java.time.LocalDateTime;
import java.util.Map;

/**
 * 模板参数实体
 *
 * @author micro-ai
 * @since 0.0.1
 */
@Data
@TableName(value = "template_parameters", autoResultMap = true)
@Schema(description = "模板参数实体")
public class TemplateParameter {

    @TableId(value = "id", type = IdType.ASSIGN_ID)
    @Schema(description = "主键ID")
    private String id;

    @TableField("template_id")
    @Schema(description = "模板ID")
    private String templateId;

    @TableField("version")
    @Schema(description = "版本号")
    private String version;

    @TableField("param_name")
    @Schema(description = "参数名称")
    private String paramName;

    @TableField("param_type")
    @Schema(description = "参数类型", allowableValues = {"string", "number", "boolean", "array", "object"})
    private String paramType;

    @TableField("default_value")
    @Schema(description = "默认值")
    private String defaultValue;

    @TableField("description")
    @Schema(description = "参数描述")
    private String description;

    @TableField(value = "constraints", typeHandler = JacksonTypeHandler.class)
    @Schema(description = "约束条件")
    private Map<String, Object> constraints;

    @TableField("param_group")
    @Schema(description = "参数组")
    private String paramGroup;

    @TableField("is_required")
    @Schema(description = "是否必填")
    private Boolean isRequired;

    @TableField("sort_order")
    @Schema(description = "排序值")
    private Integer sortOrder;

    @TableField("created_at")
    @Schema(description = "创建时间")
    private LocalDateTime createdAt;
}

